<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h2>Pesquisar</h2>
            <p:panel styleClass="container_24 clearfix " style="background: none; border: none;">
                <h:form id="form" acceptcharset="utf-8">
                    <p:growl id="msg" life="3000" />
                    <p class="subtitle">Filtros</p>
                    
                    <p:outputLabel value="Nome: " styleClass="grid_3" />
                    <p:inputText value="#{managerSearchExecutor.executor.name}" styleClass="grid_7"/>
                    <div class="clear"/>
                    
                    <p:outputLabel value="OAB: " styleClass="grid_3"  />
                    <p:inputText value="#{managerSearchExecutor.executor.oab}" styleClass="grid_7"/>

                    <div class="clear"/>
                    <div class="buttonAction">
                        <p:commandButton value="Pesquisar" icon="ui-icon-search" 
                                         actionListener="#{managerSearchExecutor.searchExecutor()}" 
                                         styleClass="ui-priority-primary"
                                         update="@form, table"/>
                        <p:commandButton value="Cancelar" icon="ui-icon-close" 
                                         actionListener="#{managerRedirect.redirect('viewExecutor.xhtml')}" 
                                         update="@form"/>
                    </div>
                    
                    <p class="subtitle">Resultado</p>
                    <p:dataTable id="table" value="#{managerSearchExecutor.searchExecutors}"
                                 var="e" emptyMessage="Nenhum Questionário"
                                 styleClass="dataTable">                       
                        <f:facet name="header">
                            <h:outputText value="Juízes"/>
                        </f:facet>

                        <p:column headerText="Nome" style="font-size: 12px; width: 300px;">
                            <h:outputText value="#{e.name}" style="font-size: 12px;"/>
                        </p:column>
                        <p:column headerText="Oab" style="font-size: 12px; width: 220px;">
                            <h:outputText value="#{e.oab}" style="font-size: 12px;"/>
                        </p:column>
                        <p:column headerText="Contato" style="font-size: 12px; width: 150px;">
                            <h:outputText value="Cel: #{e.address.cellular} Tel: #{e.address.phone} " style="font-size: 12px;"/>
                        </p:column>

                        <p:column headerText="Opções" style="font-size: 12px; width: 50px;">
                            <p:commandButton icon="ui-icon-folder-collapsed" actionListener="#{managerEditExecutor.redirect('editExecutor.xhtml', e)}" title="Editar" />
                            <p:commandButton icon="ui-icon-circle-zoomin" actionListener="#{managerSearchExecutor.redirect('showExecutor.xhtml', e)}" title="Visualizar Questionário" />
                            <p:commandButton icon="ui-icon-trash" title="Excluir" update="@form"  />
                        </p:column>
                    </p:dataTable>

                </h:form>
            </p:panel>
        </ui:define>
    </ui:composition>

</html>